<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/src/gui/widgets/qvalidator.cpp -->
<head>
  <title>Qt 4.3: QDoubleValidator Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QDoubleValidator Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1>
<p>The QDoubleValidator class provides range checking of floating-point numbers. <a href="#details">More...</a></p>
<pre> #include &lt;QDoubleValidator&gt;</pre><p>Inherits <a href="qvalidator.html">QValidator</a>.</p>
<ul>
<li><a href="qdoublevalidator-members.html">List of all members, including inherited members</a></li>
<li><a href="qdoublevalidator-qt3.html">Qt 3 support members</a></li>
</ul>
<a name="public-types"></a>
<h3>Public Types</h3>
<ul>
<li><div class="fn"/>enum <b><a href="qdoublevalidator.html#Notation-enum">Notation</a></b> { StandardNotation, ScientificNotation }</li>
</ul>
<a name="properties"></a>
<h3>Properties</h3>
<ul>
<li><div class="fn"/><b><a href="qdoublevalidator.html#bottom-prop">bottom</a></b> : double</li>
<li><div class="fn"/><b><a href="qdoublevalidator.html#decimals-prop">decimals</a></b> : int</li>
<li><div class="fn"/><b><a href="qdoublevalidator.html#notation-prop">notation</a></b> : Notation</li>
<li><div class="fn"/><b><a href="qdoublevalidator.html#top-prop">top</a></b> : double</li>
</ul>
<ul>
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="qdoublevalidator.html#QDoubleValidator">QDoubleValidator</a></b> ( QObject * <i>parent</i> )</li>
<li><div class="fn"/><b><a href="qdoublevalidator.html#QDoubleValidator-2">QDoubleValidator</a></b> ( double <i>bottom</i>, double <i>top</i>, int <i>decimals</i>, QObject * <i>parent</i> )</li>
<li><div class="fn"/><b><a href="qdoublevalidator.html#dtor.QDoubleValidator">~QDoubleValidator</a></b> ()</li>
<li><div class="fn"/>double <b><a href="qdoublevalidator.html#bottom-prop">bottom</a></b> () const</li>
<li><div class="fn"/>int <b><a href="qdoublevalidator.html#decimals-prop">decimals</a></b> () const</li>
<li><div class="fn"/>Notation <b><a href="qdoublevalidator.html#notation-prop">notation</a></b> () const</li>
<li><div class="fn"/>void <b><a href="qdoublevalidator.html#bottom-prop">setBottom</a></b> ( double )</li>
<li><div class="fn"/>void <b><a href="qdoublevalidator.html#decimals-prop">setDecimals</a></b> ( int )</li>
<li><div class="fn"/>void <b><a href="qdoublevalidator.html#notation-prop">setNotation</a></b> ( Notation )</li>
<li><div class="fn"/>virtual void <b><a href="qdoublevalidator.html#setRange">setRange</a></b> ( double <i>minimum</i>, double <i>maximum</i>, int <i>decimals</i> = 0 )</li>
<li><div class="fn"/>void <b><a href="qdoublevalidator.html#top-prop">setTop</a></b> ( double )</li>
<li><div class="fn"/>double <b><a href="qdoublevalidator.html#top-prop">top</a></b> () const</li>
<li><div class="fn"/>virtual QValidator::State <b><a href="qdoublevalidator.html#validate">validate</a></b> ( QString &amp; <i>input</i>, int &amp; <i>pos</i> ) const</li>
</ul>
<ul>
<li><div class="fn"/>4 public functions inherited from <a href="qvalidator.html#public-functions">QValidator</a></li>
<li><div class="fn"/>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
<li><div class="fn"/>5 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QDoubleValidator class provides range checking of floating-point numbers.</p>
<p>QDoubleValidator provides an upper bound, a lower bound, and a limit on the number of digits after the decimal point. It does not provide a <a href="qvalidator.html#fixup">fixup</a>() function.</p>
<p>You can set the acceptable range in one call with <a href="qdoublevalidator.html#setRange">setRange</a>(), or with <a href="qdoublevalidator.html#bottom-prop">setBottom</a>() and <a href="qdoublevalidator.html#top-prop">setTop</a>(). Set the number of decimal places with <a href="qdoublevalidator.html#decimals-prop">setDecimals</a>(). The <a href="qdoublevalidator.html#validate">validate</a>() function returns the validation state.</p>
<p>QDoubleValidator uses its <a href="qvalidator.html#locale">locale</a>() to interpret the number. For example, in the German locale, &quot;1,234&quot; will be accepted as the fractional number 1.234. In Arabic locales, QDoubleValidator will accept Arabic digits.</p>
<p>In addition, QDoubleValidator is always guaranteed to accept a number formatted according to the &quot;C&quot; locale. QDoubleValidator will not accept numbers with thousand-seperators.</p>
<p>See also <a href="qintvalidator.html">QIntValidator</a>, <a href="qregexpvalidator.html">QRegExpValidator</a>, and <a href="widgets-lineedits.html">Line Edits Example</a>.</p>
<hr />
<h2>Member Type Documentation</h2>
<h3 class="fn"><a name="Notation-enum"></a>enum QDoubleValidator::Notation</h3>
<p>This enum defines the allowed notations for entering a double.</p>
<p><table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QDoubleValidator::StandardNotation</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">The string is written as a standard number (i.e&#x2e; 0.015).</td></tr>
<tr><td valign="top"><tt>QDoubleValidator::ScientificNotation</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">The string is written in scientific form. It may have an exponent part(i.e&#x2e; 1.5E-2).</td></tr>
</table></p>
<p>This enum was introduced in Qt 4.3.</p>
<hr />
<h2>Property Documentation</h2>
<h3 class="fn"><a name="bottom-prop"></a>bottom : double</h3>
<p>This property holds the validator's minimum acceptable value.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>double bottom () const</b></li>
<li><div class="fn"/><b>void setBottom ( double )</b></li>
</ul>
<p>See also <a href="qdoublevalidator.html#setRange">setRange</a>().</p>
<h3 class="fn"><a name="decimals-prop"></a>decimals : int</h3>
<p>This property holds the validator's maximum number of digits after the decimal point.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>int decimals () const</b></li>
<li><div class="fn"/><b>void setDecimals ( int )</b></li>
</ul>
<p>See also <a href="qdoublevalidator.html#setRange">setRange</a>().</p>
<h3 class="fn"><a name="notation-prop"></a>notation : <a href="qdoublevalidator.html#Notation-enum">Notation</a></h3>
<p>This property holds the notation of how a string can describe a number.</p>
<p>This property was introduced in Qt 4.3.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>Notation notation () const</b></li>
<li><div class="fn"/><b>void setNotation ( Notation )</b></li>
</ul>
<p>See also <a href="qdoublevalidator.html#Notation-enum">Notation</a>.</p>
<h3 class="fn"><a name="top-prop"></a>top : double</h3>
<p>This property holds the validator's maximum acceptable value.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>double top () const</b></li>
<li><div class="fn"/><b>void setTop ( double )</b></li>
</ul>
<p>See also <a href="qdoublevalidator.html#setRange">setRange</a>().</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QDoubleValidator"></a>QDoubleValidator::QDoubleValidator ( <a href="qobject.html">QObject</a> * <i>parent</i> )</h3>
<p>Constructs a validator object with a <i>parent</i> object that accepts any double.</p>
<h3 class="fn"><a name="QDoubleValidator-2"></a>QDoubleValidator::QDoubleValidator ( double <i>bottom</i>, double <i>top</i>, int <i>decimals</i>, <a href="qobject.html">QObject</a> * <i>parent</i> )</h3>
<p>Constructs a validator object with a <i>parent</i> object. This validator will accept doubles from <i>bottom</i> to <i>top</i> inclusive, with up to <i>decimals</i> digits after the decimal point.</p>
<h3 class="fn"><a name="dtor.QDoubleValidator"></a>QDoubleValidator::~QDoubleValidator ()</h3>
<p>Destroys the validator.</p>
<h3 class="fn"><a name="setRange"></a>void QDoubleValidator::setRange ( double <i>minimum</i>, double <i>maximum</i>, int <i>decimals</i> = 0 )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>Sets the validator to accept doubles from <i>minimum</i> to <i>maximum</i> inclusive, with at most <i>decimals</i> digits after the decimal point.</p>
<h3 class="fn"><a name="validate"></a><a href="qvalidator.html#State-enum">QValidator::State</a> QDoubleValidator::validate ( <a href="qstring.html">QString</a> &amp; <i>input</i>, int &amp; <i>pos</i> ) const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>Returns <a href="qvalidator.html#State-enum">Acceptable</a> if the string <i>input</i> contains a double that is within the valid range and is in the correct format.</p>
<p>Returns <a href="qvalidator.html#State-enum">Intermediate</a> if <i>input</i> contains a double that is outside the range or is in the wrong format; e.g&#x2e; with too many digits after the decimal point or is empty.</p>
<p>Returns <a href="qvalidator.html#State-enum">Invalid</a> if the <i>input</i> is not a double.</p>
<p>Note: If the valid range consists of just positive doubles (e.g&#x2e; 0.0 to 100.0) and <i>input</i> is a negative double then <a href="qvalidator.html#State-enum">Invalid</a> is returned. If <a href="qdoublevalidator.html#notation-prop">notation</a>() is set to <a href="qdoublevalidator.html#Notation-enum">StandardNotation</a>, and the input contains more digits before the decimal point than a double in the valid range may have, <a href="qvalidator.html#State-enum">Invalid</a> is returned. If <a href="qdoublevalidator.html#notation-prop">notation</a>() is <a href="qdoublevalidator.html#Notation-enum">ScientificNotation</a>, and the input is not in the valid range, <a href="qvalidator.html#State-enum">Intermediate</a> is returned. The value may yet become valid by changing the exponent.</p>
<p>By default, the <i>pos</i> parameter is not used by this validator.</p>
<p>Reimplemented from <a href="qvalidator.html#validate">QValidator</a>.</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
